package service.impl;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.List;

import dto.MItem;
import service.MListManager;
import util.JacksonUtil;

public class MListManagerImplMock implements MListManager{

	@Override
	public List<MItem> getMList() {
		List<MItem> list = null;
		try {
			BufferedReader reader = new BufferedReader(new FileReader(
					"json.txt"));

			StringBuilder sb = new StringBuilder();
			String line;
			while ((line = reader.readLine()) != null) {
				sb.append(line).append("\r\n");
			}

			list = JacksonUtil.fromJsonToArray(sb.toString(),
					MItem.class);
			
			for(MItem it:list){
				System.out.println(it);
			}
			
			reader.close();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}

}
